Popular Searches
Popular Course Categories
Popular Courses

Smoke and Sanity Testing

Smoke and Sanity Testing

Introduction to Software Testing

Smoke and Sanity Testing

Smoke Testing and Sanity Testing are important software testing techniques used to quickly determine whether an application build is stable enough for further testing and whether a particular change or functionality is working correctly. Both are generally performed before deeper levels of testing to reduce unnecessary testing effort and identify major problems at an early stage.

Smoke Testing focuses on checking the critical and major functionalities of an application to determine whether the build is stable for detailed testing. Sanity Testing is a focused testing activity performed after minor changes, bug fixes, or enhancements to verify that the specific functionality works correctly and that the related areas have not been obviously broken.

In Selenium automation, Smoke and Sanity Testing can be automated for web applications using Selenium WebDriver along with frameworks such as TestNG. JustAcademy's Selenium Automation Testing curriculum includes software testing fundamentals and types of testing such as smoke testing, along with Selenium WebDriver, TestNG, Page Object Model, cross-browser testing, regression testing, and automation frameworks.

Selenium Training Resource: JustAcademy Selenium Training

Course Demo Registration: Register for Selenium Course Demo


1. What is Smoke Testing?

Smoke Testing is a preliminary testing technique used to verify whether the major and critical functionalities of a software build are working correctly. It is usually performed when a new build is received from the development team.

The main purpose of Smoke Testing is to determine whether the build is stable enough to proceed with detailed testing.

Simple Definition

Smoke Testing is a high-level test performed on a new build to verify that the critical features of the application are functioning and the build is stable enough for further testing.

Example

Suppose an e-commerce application receives a new build. Before executing hundreds of detailed test cases, testers may verify:

  • Application opens successfully.
  • Login works.
  • Product search works.
  • Product details page opens.
  • Product can be added to the cart.
  • Checkout page opens.
  • Logout works.

If these major functions are working, the build can proceed to detailed testing.


2. Why is Smoke Testing Required?

Modern applications can contain thousands of test cases. Executing all test cases on every new build is inefficient if the build itself has a major problem.

Smoke Testing provides an early indication of build stability.

Main Objectives

  • Verify build stability.
  • Identify critical build failures quickly.
  • Prevent wasted testing effort.
  • Verify important application workflows.
  • Determine whether detailed testing should begin.
  • Provide quick feedback to developers.
  • Support continuous integration and continuous delivery processes.

Basic Smoke Testing Flow

New Application Build
        ↓
Install / Deploy Build
        ↓
Execute Critical Test Cases
        ↓
Check Major Features
        ↓
Build Stable?
     ↙       ↘
   Yes        No
    ↓          ↓
Detailed     Reject Build
Testing      / Report Defects

3. What is Sanity Testing?

Sanity Testing is a focused testing technique performed after specific changes, bug fixes, enhancements, or minor modifications to verify that the affected functionality is working correctly.

Unlike Smoke Testing, which generally evaluates the overall stability of a build at a high level, Sanity Testing concentrates on a narrower area of the application.

Simple Definition

Sanity Testing is a focused testing process used to verify that a particular change or bug fix works correctly and that the related functionality is still behaving as expected.

Example

Suppose the login password validation logic has been changed.

Instead of testing the complete application, the tester may focus on:

  • Valid username and password.
  • Invalid password.
  • Empty password.
  • Password validation message.
  • Forgot password functionality.
  • Login redirection.

4. Why is Sanity Testing Required?

Sanity Testing helps testers quickly determine whether a specific modification has been implemented correctly.

Main Objectives

  • Verify a specific bug fix.
  • Check newly modified functionality.
  • Validate related features.
  • Detect obvious side effects.
  • Avoid executing the complete regression suite unnecessarily.
  • Provide quick feedback after small changes.

5. Smoke Testing vs Sanity Testing

FeatureSmoke TestingSanity Testing
PurposeCheck overall build stabilityCheck specific functionality or change
ScopeBroad but shallowNarrow but focused
Performed OnNew buildModified or corrected build
FocusCritical application featuresSpecific affected functionality
Test CoverageHigh-level coverageFocused coverage
Detailed TestingNot normally detailedMore focused on the affected area
AutomationCan be automatedCan be automated
Typical ResultAccept or reject build for further testingConfirm the specific change is functioning correctly

6. Smoke Testing vs Regression Testing

Smoke Testing and Regression Testing have different objectives.

Smoke TestingRegression Testing
Checks critical functionality.Checks existing functionality after changes.
Usually broad and shallow.Can be broad and detailed.
Usually performed on a new build.Performed after changes, fixes, or enhancements.
Determines whether the build is testable.Determines whether existing functionality remains unaffected.
Usually smaller test suite.Usually larger test suite.

7. Smoke Testing vs Retesting

Smoke TestingRetesting
Checks whether a build is stable.Checks whether a particular defect has been fixed.
Tests critical application workflows.Tests the previously failed scenario.
Can contain multiple critical test cases.Usually focuses on a specific defect.
Performed on a new build.Performed after a defect fix.

8. Smoke Testing Process

A typical Smoke Testing process can be represented as follows:

Build Received
      ↓
Build Deployment
      ↓
Identify Critical Features
      ↓
Execute Smoke Test Cases
      ↓
Verify Major Workflows
      ↓
Analyze Results
      ↓
Build Accepted or Rejected

Step 1: Receive the Build

The development team provides a new build for testing.

Step 2: Deploy the Build

The build is deployed into the appropriate test environment.

Step 3: Identify Critical Features

Testers identify the most important application workflows.

Step 4: Execute Smoke Tests

Critical test cases are executed.

Step 5: Analyze Results

If critical workflows work correctly, the build can proceed to detailed testing. If major functionality is broken, the build may be rejected for further testing.


9. Sanity Testing Process

Requirement / Bug Fix
        ↓
Build Received
        ↓
Identify Changed Functionality
        ↓
Identify Related Features
        ↓
Execute Focused Tests
        ↓
Verify Expected Behavior
        ↓
Analyze Results
        ↓
Proceed to Regression / Further Testing

Step 1: Understand the Change

The tester reviews the requirement, enhancement, or bug fix.

Step 2: Identify the Affected Area

The specific module or functionality affected by the change is identified.

Step 3: Prepare Focused Test Cases

Only relevant test cases are selected.

Step 4: Execute Tests

The affected functionality and closely related functionality are tested.

Step 5: Analyze Results

If the change behaves correctly, further testing such as regression testing can be performed.


10. When is Smoke Testing Performed?

Smoke Testing is commonly performed when a new build is delivered to the testing team.

Typical Situations

  • New application build.
  • Major application changes.
  • New deployment.
  • New release candidate.
  • Build received from development.
  • Deployment through a CI/CD pipeline.
  • Major configuration changes.

11. When is Sanity Testing Performed?

  • After a bug fix.
  • After a minor enhancement.
  • After a specific functionality is modified.
  • After a small code change.
  • When a previously failed feature has been corrected.
  • Before executing a larger regression suite.

12. Smoke Testing Example – E-Commerce Application

Consider an e-commerce application containing login, product search, product details, cart, checkout, payment, and order confirmation.

Smoke Test Cases

Test CaseExpected Result
Open applicationApplication loads successfully
LoginUser successfully logs in
Search productSearch results are displayed
Open productProduct details page opens
Add to cartProduct is added to cart
Open checkoutCheckout page opens
LogoutUser successfully logs out

Smoke Testing Flow

Open Website
      ↓
Login
      ↓
Search Product
      ↓
Open Product
      ↓
Add to Cart
      ↓
Checkout
      ↓
Logout
      ↓
Build Stability Result

13. Sanity Testing Example – E-Commerce Application

Suppose the development team modifies the shopping cart quantity functionality.

Focused Sanity Tests

  • Add product to cart.
  • Increase quantity.
  • Decrease quantity.
  • Remove product.
  • Verify total price.
  • Verify cart count.
  • Proceed to checkout.

The tester does not necessarily need to execute the complete application test suite for this focused validation.


14. Smoke Testing in Agile

Smoke Testing is useful in Agile development because builds can be produced frequently during development and sprint execution.

User Story
     ↓
Development
     ↓
Build
     ↓
Smoke Testing
     ↓
Detailed Functional Testing
     ↓
Defect Fix
     ↓
Retesting
     ↓
Regression Testing
     ↓
Sprint Validation
     ↓
Release

Benefits in Agile

  • Fast build validation.
  • Early defect detection.
  • Quick developer feedback.
  • Reduced wasted testing effort.
  • Better support for frequent builds.

15. Smoke Testing in CI/CD

Smoke tests can be integrated into CI/CD pipelines so that a newly deployed build is automatically checked before more extensive testing or deployment stages.

Developer Commit
       ↓
Source Control
       ↓
Build
       ↓
Deploy to Test Environment
       ↓
Automated Smoke Tests
       ↓
Test Results
       ↓
Pass / Fail
    ↙       ↘
  Pass       Fail
   ↓           ↓
Next Stage   Stop Pipeline

Example

After a new application build is deployed, automated Selenium tests can verify that the login page loads, login works, the dashboard opens, and the main navigation is available.


16. Selenium and Smoke Testing

Selenium WebDriver can automate Smoke Testing for web applications. Selenium allows testers to interact with browsers and verify important application workflows.

Selenium Smoke Testing Flow

Smoke Test Case
       ↓
Selenium WebDriver
       ↓
Browser
       ↓
Web Application
       ↓
User Interaction
       ↓
Application Response
       ↓
Assertion
       ↓
Pass / Fail

17. Why Use Selenium for Smoke Testing?

  • Automates repetitive browser actions.
  • Reduces manual execution time.
  • Can execute tests across supported browsers.
  • Can be integrated with TestNG and other test frameworks.
  • Supports reusable automation code.
  • Can be integrated into CI/CD pipelines.
  • Provides repeatable test execution.
  • Can validate critical web application workflows.

18. Selenium Smoke Testing Example

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class SmokeTest {

    public static void main(String[] args) {

        WebDriver driver = new ChromeDriver();

        driver.get("https://example.com");

        driver.findElement(By.id("username"))
                .sendKeys("[email protected]");

        driver.findElement(By.id("password"))
                .sendKeys("Test@123");

        driver.findElement(By.id("loginButton"))
                .click();

        String title = driver.getTitle();

        System.out.println("Application Title: " + title);

        driver.quit();
    }
}

Explanation

  • ChromeDriver: Opens the Chrome browser through WebDriver.
  • get(): Opens the application URL.
  • findElement(): Locates web elements.
  • sendKeys(): Enters test data.
  • click(): Performs a click action.
  • getTitle(): Retrieves the page title.
  • quit(): Closes the browser session.

19. Selenium Sanity Testing Example

Suppose the login module has been modified. A Selenium Sanity Test can focus on the login workflow.

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class LoginSanityTest {

    public static void main(String[] args) {

        WebDriver driver = new ChromeDriver();

        driver.get("https://example.com/login");

        driver.findElement(By.id("username"))
                .sendKeys("[email protected]");

        driver.findElement(By.id("password"))
                .sendKeys("Test@123");

        driver.findElement(By.id("loginButton"))
                .click();

        String currentUrl = driver.getCurrentUrl();

        if (currentUrl.contains("dashboard")) {
            System.out.println("Login Sanity Test Passed");
        } else {
            System.out.println("Login Sanity Test Failed");
        }

        driver.quit();
    }
}

20. Smoke Testing with TestNG

TestNG can be used to organize automated smoke test cases and execute selected tests.

import org.testng.annotations.Test;

public class SmokeTests {

    @Test
    public void loginSmokeTest() {
        System.out.println("Login Smoke Test");
    }

    @Test
    public void searchSmokeTest() {
        System.out.println("Search Smoke Test");
    }

    @Test
    public void cartSmokeTest() {
        System.out.println("Cart Smoke Test");
    }
}

Advantages of TestNG

  • Annotations.
  • Test grouping.
  • Assertions.
  • Parallel execution.
  • Test dependencies.
  • Reports.
  • Suite configuration.

21. Smoke Test Group in TestNG

TestNG groups can be used to separate smoke tests from other test types.

import org.testng.annotations.Test;

public class TestSuite {

    @Test(groups = {"smoke"})
    public void loginTest() {
        System.out.println("Login Smoke Test");
    }

    @Test(groups = {"smoke"})
    public void searchTest() {
        System.out.println("Search Smoke Test");
    }

    @Test(groups = {"regression"})
    public void detailedCheckoutTest() {
        System.out.println("Checkout Regression Test");
    }
}

This approach allows teams to execute only the smoke tests when they need a quick build validation.


22. Sanity Test Group in TestNG

import org.testng.annotations.Test;

public class SanityTests {

    @Test(groups = {"sanity"})
    public void loginValidation() {
        System.out.println("Login Sanity Test");
    }

    @Test(groups = {"sanity"})
    public void passwordValidation() {
        System.out.println("Password Sanity Test");
    }

    @Test(groups = {"sanity"})
    public void dashboardValidation() {
        System.out.println("Dashboard Sanity Test");
    }
}

23. Smoke Testing Test Suite

A Smoke Test Suite contains a small set of critical test cases designed to validate the basic health of an application.

ModuleSmoke Test
LoginValid user can log in
SearchSearch returns results
ProductProduct details open
CartProduct can be added
CheckoutCheckout page opens
LogoutUser can log out

24. Sanity Test Suite

A Sanity Test Suite is focused on a particular feature, module, enhancement, or bug fix.

ChangeSanity Test
Login validation changedValidate login scenarios
Password reset changedValidate reset password flow
Cart quantity changedValidate quantity and price calculation
Search filter changedValidate filtering functionality
Checkout address changedValidate address selection and checkout

25. Smoke Testing and Build Verification

Smoke Testing is sometimes described as Build Verification Testing because it verifies whether the basic build is stable enough for further testing.

Example

If an application cannot open the login page, there is little value in executing hundreds of detailed test cases. Smoke Testing identifies this type of critical problem early.


26. Sanity Testing and Bug Fixes

Sanity Testing is particularly useful after bug fixes.

Defect Reported
      ↓
Developer Fix
      ↓
New Build
      ↓
Sanity Testing
      ↓
Verify Fixed Functionality
      ↓
Verify Related Functionality
      ↓
Regression Testing
      ↓
Final Validation

27. Smoke Testing and Regression Testing Together

Smoke Testing and Regression Testing can work together as part of a larger testing process.

New Build
   ↓
Smoke Testing
   ↓
Build Stable?
   ↓
Yes
   ↓
Functional Testing
   ↓
Bug Fixes
   ↓
Retesting
   ↓
Regression Testing
   ↓
Release Validation

The smoke suite provides a quick initial check, while the regression suite provides broader validation after changes.


28. Smoke Testing Checklist

  • Application launches successfully.
  • Login page loads.
  • Valid login works.
  • Main dashboard opens.
  • Primary navigation works.
  • Important pages open.
  • Search works.
  • Critical forms submit successfully.
  • Major workflows can be completed.
  • Logout works.
  • No critical blocking error occurs.

29. Sanity Testing Checklist

  • Understand the change or bug fix.
  • Identify the affected module.
  • Identify related functionality.
  • Prepare focused test cases.
  • Verify the corrected functionality.
  • Verify important related scenarios.
  • Check for obvious side effects.
  • Record failures.
  • Retest failed scenarios after fixes.
  • Proceed with regression testing when required.

30. Selenium Smoke Testing Checklist

  • Verify browser launches.
  • Verify application URL loads.
  • Verify login.
  • Verify main navigation.
  • Verify critical page loading.
  • Verify primary user workflow.
  • Verify critical buttons.
  • Verify important forms.
  • Verify logout.
  • Close browser after execution.

31. Selenium Sanity Testing Checklist

  • Identify changed functionality.
  • Create focused Selenium tests.
  • Use reliable locators.
  • Use appropriate waits.
  • Validate expected results.
  • Use assertions.
  • Capture failure information.
  • Keep tests independent.
  • Execute related sanity scenarios.
  • Run regression tests when appropriate.

32. Assertions in Smoke and Sanity Testing

Assertions are important because simply executing browser actions does not prove that the application behaved correctly.

String expectedTitle = "Dashboard";
String actualTitle = driver.getTitle();

if (actualTitle.equals(expectedTitle)) {
    System.out.println("Smoke Test Passed");
} else {
    System.out.println("Smoke Test Failed");
}

In TestNG, assertions can be used directly:

import org.testng.Assert;
import org.testng.annotations.Test;

@Test
public void dashboardTest() {

    String expectedTitle = "Dashboard";
    String actualTitle = driver.getTitle();

    Assert.assertEquals(actualTitle, expectedTitle);
}

33. Selenium Waits in Smoke and Sanity Testing

Dynamic web applications may take time to load elements. Explicit waits can make automation more reliable by waiting for a specific condition.

WebDriverWait wait =
        new WebDriverWait(driver, Duration.ofSeconds(10));

WebElement loginButton =
        wait.until(
            ExpectedConditions.elementToBeClickable(
                By.id("loginButton")
            )
        );

loginButton.click();

Why Waits Matter

  • Reduce timing-related failures.
  • Handle dynamic web elements.
  • Improve test stability.
  • Reduce unnecessary hard-coded delays.

34. Page Object Model for Smoke and Sanity Testing

Page Object Model, commonly called POM, separates page-specific locators and actions from test cases.

Example Page Class

public class LoginPage {

    WebDriver driver;

    By username = By.id("username");
    By password = By.id("password");
    By loginButton = By.id("loginButton");

    public LoginPage(WebDriver driver) {
        this.driver = driver;
    }

    public void enterUsername(String value) {
        driver.findElement(username).sendKeys(value);
    }

    public void enterPassword(String value) {
        driver.findElement(password).sendKeys(value);
    }

    public void clickLogin() {
        driver.findElement(loginButton).click();
    }
}

Test Usage

LoginPage loginPage = new LoginPage(driver);

loginPage.enterUsername("[email protected]");
loginPage.enterPassword("Test@123");
loginPage.clickLogin();

POM becomes particularly useful when Smoke and Sanity suites grow and many tests reuse the same application pages.


35. Smoke Testing Framework Structure

selenium-project/
│
├── src/test/java/
│   ├── tests/
│   │   ├── LoginSmokeTest.java
│   │   ├── SearchSmokeTest.java
│   │   └── CartSmokeTest.java
│   │
│   ├── pages/
│   │   ├── LoginPage.java
│   │   ├── HomePage.java
│   │   └── CartPage.java
│   │
│   └── utilities/
│       ├── DriverManager.java
│       └── TestData.java
│
├── testng.xml
└── pom.xml

36. Smoke Testing in a Real Project

Consider an online shopping application.

Application Modules

  • Login.
  • Registration.
  • Product Search.
  • Product Details.
  • Shopping Cart.
  • Checkout.
  • Payment.
  • Order Management.
  • Logout.

Smoke Suite

Login
  ↓
Search Product
  ↓
Open Product
  ↓
Add to Cart
  ↓
Checkout
  ↓
Logout

This suite does not need to cover every possible combination of product filters, payment methods, addresses, or negative scenarios. Its primary purpose is to quickly determine whether the critical application workflow is functioning.


37. Sanity Testing in a Real Project

Suppose the payment confirmation page has been modified.

Sanity Scope

  • Complete checkout.
  • Submit payment.
  • Verify payment response.
  • Verify confirmation page.
  • Verify order number.
  • Verify order status.
  • Verify confirmation message.

After successful sanity validation, the team may execute a broader regression suite covering other existing application functionality.


38. Smoke Testing in Continuous Integration

Smoke tests are well suited for early stages of a CI pipeline because they can provide quick feedback after a build.

Developer
    ↓
Git Commit
    ↓
CI Server
    ↓
Build
    ↓
Deploy
    ↓
Smoke Tests
    ↓
Smoke Passed?
   ↙       ↘
 Yes        No
  ↓          ↓
Continue   Stop / Notify
Pipeline   Team

39. Smoke Testing and Selenium Grid

Selenium Grid can be used when Smoke Testing needs to run against multiple browsers or environments.

Example

BrowserSmoke Test
ChromeLogin and checkout
FirefoxLogin and checkout
EdgeLogin and checkout

This can help identify browser-specific problems early in the testing process.


40. Manual Smoke Testing

Smoke Testing can be performed manually by executing a predefined set of critical test cases.

Advantages

  • Easy to start.
  • No automation setup required.
  • Useful for small applications.
  • Useful during initial development.

Limitations

  • Repeated manual effort.
  • Slower for frequent builds.
  • Higher possibility of human error.
  • Less suitable for large applications with frequent deployments.

41. Automated Smoke Testing

Automated Smoke Testing uses automation tools such as Selenium to execute predefined critical tests.

Advantages

  • Fast execution.
  • Repeatability.
  • Reduced manual effort.
  • Useful for frequent builds.
  • Can run in CI/CD pipelines.
  • Can generate automated results.

42. Manual vs Automated Smoke Testing

ManualAutomated
Executed by tester.Executed by automation script.
Requires manual effort.Requires initial automation development.
Slower for repeated execution.Faster for repeated execution.
Useful for exploratory checks.Useful for stable repetitive scenarios.
Limited CI/CD integration.Strong CI/CD integration.

43. Common Smoke Testing Mistakes

  • Including too many detailed test cases.
  • Testing every possible scenario.
  • Ignoring critical business workflows.
  • Using unstable automation scripts.
  • Ignoring environment issues.
  • Not updating the smoke suite after major application changes.
  • Failing to report build-blocking defects.
  • Using unreliable test data.

44. Common Sanity Testing Mistakes

  • Testing unrelated modules.
  • Making the sanity suite too large.
  • Not understanding the actual code change.
  • Testing only the exact changed field and ignoring related functionality.
  • Skipping verification of expected results.
  • Using unreliable test data.
  • Not performing regression when required.

45. Best Practices for Smoke Testing

  • Keep the smoke suite small.
  • Focus on critical business functionality.
  • Automate stable repetitive scenarios.
  • Keep tests independent.
  • Use reliable test data.
  • Use explicit waits for dynamic elements.
  • Use meaningful assertions.
  • Run smoke tests after every important build.
  • Integrate automated smoke tests with CI/CD.
  • Review and update the suite regularly.

46. Best Practices for Sanity Testing

  • Understand the exact change before testing.
  • Identify affected functionality.
  • Include related workflows.
  • Keep the scope focused.
  • Use targeted test data.
  • Use reliable locators in Selenium.
  • Validate expected behavior with assertions.
  • Run regression testing when the change can affect other modules.
  • Document the scenarios executed.

47. Smoke and Sanity Testing Decision Flow

New Build
    ↓
Is this a major/new build?
    ↓
Smoke Testing
    ↓
Build Stable?
  ↙       ↘
No        Yes
 ↓          ↓
Reject     Detailed Testing
Build         ↓
              Change / Bug Fix
                    ↓
              Sanity Testing
                    ↓
             Function Correct?
                ↙       ↘
              No        Yes
               ↓          ↓
            Report      Regression
            Defect       Testing

48. Practical Smoke Testing Project

Project: E-Commerce Web Application

Objective

Create a Selenium-based Smoke Test Suite that validates the most important user workflow.

Required Scenarios

  1. Launch application.
  2. Verify home page.
  3. Login.
  4. Search for a product.
  5. Open product details.
  6. Add product to cart.
  7. Open cart.
  8. Verify product.
  9. Open checkout.
  10. Logout.

Expected Result

The complete critical workflow should execute successfully. If a critical step fails, the smoke suite should report the failure.


49. Practical Sanity Testing Project

Project: Shopping Cart Enhancement

Change

The development team has changed the shopping cart quantity functionality.

Sanity Scenarios

  1. Login.
  2. Open product.
  3. Add product to cart.
  4. Increase quantity.
  5. Verify quantity.
  6. Verify price calculation.
  7. Decrease quantity.
  8. Remove product.
  9. Verify cart state.

50. Smoke Testing Test Case Example

Test Case IDScenarioExpected ResultPriority
SMK001Launch applicationApplication opensHigh
SMK002LoginUser logs inHigh
SMK003Search productResults displayedHigh
SMK004Add productProduct added to cartHigh
SMK005Open checkoutCheckout opensHigh

51. Sanity Testing Test Case Example

Test Case IDScenarioExpected Result
SAN001Updated login validationCorrect validation displayed
SAN002Invalid passwordError message displayed
SAN003Valid passwordUser logs in
SAN004Dashboard redirectionDashboard opens

52. Smoke and Sanity Testing in Different Environments

Testing environments can include development, QA, staging, and pre-production environments.

EnvironmentTypical Testing
DevelopmentDeveloper-level verification and basic testing
QASmoke, functional, sanity, regression testing
StagingRelease validation and broader testing
ProductionControlled post-deployment verification where applicable

53. Smoke Testing and Release Validation

Smoke Testing can be used as an initial validation layer before more detailed release testing.

Release Build
     ↓
Deployment
     ↓
Smoke Testing
     ↓
Critical Functions Working?
     ↓
Yes
     ↓
Detailed Testing
     ↓
Regression Testing
     ↓
Release Validation

54. Smoke Testing Metrics

Teams can track basic metrics to understand smoke suite effectiveness.

MetricDescription
Smoke Test Pass RatePercentage of smoke tests that pass
Smoke Test Execution TimeTime required to complete the suite
Build Rejection RateFrequency with which builds fail smoke testing
Critical DefectsCritical problems discovered during smoke testing
Automation StabilityReliability of automated smoke tests

55. Sanity Testing Metrics

  • Number of sanity tests executed.
  • Sanity test pass rate.
  • Defects discovered during sanity testing.
  • Time taken for sanity execution.
  • Number of failed bug fixes.
  • Number of affected related scenarios.

56. Smoke Testing Interview Questions

Q1. What is Smoke Testing?

Smoke Testing is a preliminary testing technique used to verify that the critical functionality of a build is working and that the build is stable enough for further testing.

Q2. Why is Smoke Testing performed?

It is performed to identify major build-level problems early and prevent testers from spending time on a build that is not stable.

Q3. Can Smoke Testing be automated?

Yes. Smoke Testing can be automated using tools such as Selenium for web applications.

Q4. Is Smoke Testing broad or narrow?

Smoke Testing is generally broad in coverage but shallow in depth.

Q5. When is Smoke Testing performed?

It is commonly performed when a new build is available for testing.


57. Sanity Testing Interview Questions

Q1. What is Sanity Testing?

Sanity Testing is focused testing performed after a change or bug fix to verify that the affected functionality works correctly.

Q2. Why is Sanity Testing performed?

It helps quickly verify whether a particular change or fix behaves as expected.

Q3. Can Sanity Testing be automated?

Yes. Stable sanity scenarios can be automated using Selenium and a test framework such as TestNG.

Q4. Is Sanity Testing broad or narrow?

Sanity Testing is generally narrow and focused on a particular area.


58. Scenario-Based Interview Questions

Scenario 1: New Build Received

Question: A new build has been deployed to the QA environment. What testing should be performed first?

Answer: A Smoke Test Suite can be executed first to verify that critical application functionality is working and the build is stable enough for detailed testing.

Scenario 2: Login Bug Fixed

Question: A login defect has been fixed. What testing would you perform?

Answer: Focused testing of the login functionality can be performed as Sanity Testing, followed by broader regression testing when appropriate.

Scenario 3: Cart Feature Modified

Question: The cart quantity calculation has changed. What should be tested?

Answer: The changed quantity calculation and closely related cart functionality should be verified through focused Sanity Testing.


59. Common Selenium Problems in Smoke Testing

  • Incorrect locators.
  • Element synchronization problems.
  • Application loading delays.
  • Browser compatibility issues.
  • Test data problems.
  • Environment instability.
  • Hard-coded waits.
  • Unstable test scripts.

60. How to Improve Selenium Smoke Test Stability?

  • Use stable locators.
  • Prefer explicit waits where appropriate.
  • Use Page Object Model.
  • Keep tests independent.
  • Use reusable utility methods.
  • Maintain controlled test data.
  • Use assertions.
  • Capture screenshots on failures.
  • Generate execution reports.
  • Run tests in clean environments when possible.

61. Smoke and Sanity Testing Quick Comparison

Smoke TestingSanity Testing
New build validationChange/fix validation
Broad and shallowNarrow and focused
Critical application featuresSpecific affected functionality
Checks build stabilityChecks change stability
Usually executed before detailed testingUsually executed after a specific change or fix
Can be automatedCan be automated
Can be integrated with CI/CDCan be integrated with CI/CD

62. Smoke and Sanity Testing Flow in a Real Project

Development
     ↓
Build Created
     ↓
Deployment
     ↓
Smoke Testing
     ↓
Build Stable?
   ↙       ↘
 No        Yes
 ↓           ↓
Defect      Functional Testing
Report           ↓
                Change / Fix
                    ↓
                Sanity Testing
                    ↓
              Function Correct?
                 ↙       ↘
               No        Yes
                ↓          ↓
             Defect      Regression
             Fix         Testing
                            ↓
                       Release Testing

63. Practical Selenium Assignment – Smoke Testing

Assignment: Create an automated Selenium Smoke Test Suite for an e-commerce web application.

Requirements

  1. Open the application.
  2. Verify the home page.
  3. Login with valid credentials.
  4. Search for a product.
  5. Open product details.
  6. Add the product to the cart.
  7. Open the cart.
  8. Verify the product.
  9. Open checkout.
  10. Logout.

Technical Requirements

  • Java.
  • Selenium WebDriver.
  • TestNG.
  • Page Object Model.
  • Explicit waits.
  • Assertions.
  • TestNG groups.
  • HTML test reporting.

64. Practical Selenium Assignment – Sanity Testing

Assignment: Automate Sanity Testing for a modified login module.

Requirements

  1. Open login page.
  2. Enter valid username.
  3. Enter valid password.
  4. Click login.
  5. Verify dashboard.
  6. Test invalid password.
  7. Verify error message.
  8. Test empty password.
  9. Verify validation.
  10. Verify logout.

65. Learning Outcomes

After completing these Smoke and Sanity Testing notes, learners should be able to:

  • Explain Smoke Testing.
  • Explain Sanity Testing.
  • Differentiate Smoke and Sanity Testing.
  • Differentiate Smoke Testing and Regression Testing.
  • Understand when Smoke Testing is performed.
  • Understand when Sanity Testing is performed.
  • Create Smoke Test Cases.
  • Create Sanity Test Cases.
  • Automate Smoke Testing using Selenium.
  • Automate Sanity Testing using Selenium.
  • Use TestNG groups for Smoke and Sanity Tests.
  • Use assertions for validation.
  • Use Page Object Model.
  • Use Selenium waits.
  • Integrate automated smoke tests with CI/CD pipelines.
  • Design practical Selenium testing suites.

66. Selenium Training Resource

For structured Selenium automation training covering Selenium WebDriver, TestNG, Page Object Model, automation frameworks, cross-browser testing, regression testing, and practical projects, visit the JustAcademy Selenium Training page.

Click Here to Explore JustAcademy Selenium Training

Click Here to Register for Course Demo


67. Summary

Smoke Testing and Sanity Testing are important testing techniques used to provide quick feedback about an application's stability and changes.

Smoke Testing focuses on critical application functionality and determines whether a new build is stable enough for further testing.

Sanity Testing focuses on a specific change, enhancement, or bug fix and verifies that the affected functionality works correctly.

In Selenium automation, both types of testing can be implemented using Selenium WebDriver, TestNG, assertions, Page Object Model, explicit waits, reusable utilities, and CI/CD integration.

Smoke Testing
     ↓
Build Stability
     ↓
Detailed Testing
     ↓
Changes / Bug Fixes
     ↓
Sanity Testing
     ↓
Regression Testing
     ↓
Release Validation

Understanding the difference between Smoke and Sanity Testing helps testers select the appropriate testing scope, reduce unnecessary execution time, identify problems earlier, and build maintainable Selenium automation suites.

whatsapp